import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from "rxjs";

@Injectable({
  providedIn: 'root'
})
export class FinanceAfterSaleDetailService {

  // 售后明细--URL
  public afterSalesUrl = '/orderRefund/find';
  // 售后明细导出--URL
  public afterSalesExportUrl = '/orderRefund/findExcel';
  // 订单售后详情table
  public modelDetailsUrl = '/orderRefund/findOrderRefund';

  constructor(public httpClient: HttpClient) { }

  // 售后明细tabledata
  public afterSalesTable(json: any | null): Observable<any> {
    // json.name = json.name.trim();
    return this.httpClient.post(this.afterSalesUrl, json);
  }

  // 售后明细tabledata导出
  public afterSalesExportTable(params?: any) {
    return this.httpClient.get(this.afterSalesExportUrl, { params, responseType: 'blob' }).toPromise();
  }

  /**
   * 订单售后详情table
   * @params params
   */
  public async getOrderTableData(params: any) {
    return await this.httpClient.post(this.modelDetailsUrl, params).toPromise();
  }

}



